<?PHP
require_once("./include/membersite_config.php");

if(!$fgmembersite->CheckLogin())
{
    $fgmembersite->RedirectToURL("login.php");
    exit;
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
      <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
      <title>Home page</title>
     
     
     
     
	  <script src="lib/CodeMirror-2.0/lib/codemirror.js" type="text/javascript"></script>
	<link rel="stylesheet" href="lib/CodeMirror-2.0/lib/codemirror.css">
	<script src="lib/CodeMirror-2.0/mode/javascript/javascript.js"></script>
	<link rel="stylesheet" href="lib/CodeMirror-2.0/mode/javascript/javascript.css">


		<script src="js/codemirror-ui.js" type="text/javascript"></script>
		<link rel="stylesheet" href="css/codemirror-ui.css" type="text/css" media="screen" />
       
       
<script type="text/javascript">
 var textarea = document.getElementById('code');
var uiOptions = { path : 'js/', searchMode : 'popup' }
var codeMirrorOptions = { mode: "javascript" }

//then create the editor
var editor = new CodeMirrorUI(textarea,uiOptions,codeMirrorOptions);
</script>	






</head>
<body>
<div id='fg_membersite_content'>
<h2>Welcome <?= $fgmembersite->UserFullName(); ?>!</h2>
This is a demo application. It can be used for viewing the code 
you have written in your favourite editor. </br>You can also download 
the code from your invite to your editor.   
</br></br>
<div>
<textarea id="code" cols="120" rows="20">
 <?php
 		
 		$file = $fgmembersite->UserEmail().".txt";
 		echo file_get_contents($file);
        
       ?>
</textarea>
</div>
<input type="button" value="Refresh" onClick="window.location.reload()">

<!--<p><a href='change-pwd.php'>Change password</a></p>-->

<!--<p><a href='access-controlled.php'>A sample 'members-only' page</a></p>-->
<p><a href='logout.php'>Logout</a></p>
</div>

<script type="text/javascript">
  var textarea = document.getElementById('code');
  var editor = new MirrorFrame(CodeMirror.replace(textarea), {
    height: "350px",
    content: textarea.value,
    parserfile: ["tokenizejavascript.js", "parsejavascript.js"],
    stylesheet: "css/jscolors.css",
    path: "js/",
    autoMatchParens: true
  });
</script>
</body>
</html>
